<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>班级操作表</title>
  <style>
    .custom-table {
      border-collapse: collapse;
      width: 100%;
    }

    .custom-table th,
    .custom-table td {
      border: 1px solid #ddd;
      padding: 8px;
    }

    .custom-table tr:nth-child(even) {
      background-color: #f2f2f2;
    }

    .custom-button {
      background-color: #4CAF50;
      color: white;
      padding: 8px 16px;
      border: none;
      text-align: center;
      text-decoration: none;
      display: inline-block;
      font-size: 14px;
      margin: 4px 2px;
      cursor: pointer;
      border-radius: 4px;
    }

    .custom-button:hover {
      background-color: #45a049;
    }
  </style>
  <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/4.3.1/css/bootstrap.min.css">
  <link rel="stylesheet" href="/css/comon0.css">
</head>
<body>
<h1 style="text-align: center; color: blue; font-family: Arial, sans-serif;">班级管理页面</h1>

<div>
  <a th:href="@{/addClass}" style="color: #222222; float: none ;background: #deab8a" class="btn btn-primary btn-sm">添加班级信息</a>
</div>

  <table border="1" class="table table-striped table-responsive-md">
    <thead style="border: #222222 1px ridge">
    <tr>
      <th>
        <a th:href="@{'/page1/' + ${currentPage1} + '?sortField=name&sortDir=' + ${reverseSortDir1}}">
          班级名称</a>
      </th>


      <th> 操作 </th>
    </tr>
    </thead>
    <tbody>
    <tr th:each="class : ${listClass}">
      <td th:text="${class.name}"></td>
      <td> <a th:href="@{/updateClass{id}(id=${class.id})}" class="btn btn-primary">修改</a>
        <a th:href="@{/deleteClass{id}(id=${class.id})}" class="btn btn-danger">删除</a>
      </td>
    </tr>
    </tbody>
  </table>

</form>
<div th:if = "${totalPages1 > 1}">
  <div class = "row col-sm-10">
    <div class = "col-sm-3">
      数据条目 : [[${totalItems}]]
    </div>
    <div class = "col-sm-5">
					<span th:each="i: ${#numbers.sequence(1, totalPages1)}">
						<a th:if="${currentPage1 != i}" th:href="@{'/page1/' + ${i}+ '?sortField=' + ${sortField1} + '&sortDir=' + ${sortDir1}}">[[${i}]]</a>
						<span th:unless="${currentPage1 != i}">[[${i}]]</span>  &nbsp; &nbsp;
					</span>
    </div>
    <div class = "col-sm-1">
      <a th:if="${currentPage1 < totalPages1}" th:href="@{'/page1/' + ${currentPage1 + 1}+ '?sortField=' + ${sortField1} + '&sortDir=' + ${sortDir1}}">Next</a>
      <span th:unless="${currentPage1 < totalPages1}">下一页</span>
    </div>

    <div class="col-sm-1">
      <a th:if="${currentPage1 < totalPages1}" th:href="@{'/page1/' + ${totalPages1}+ '?sortField=' + ${sortField1} + '&sortDir=' + ${sortDir1}}">Last</a>
      <span th:unless="${currentPage1 < totalPages1}">最后一页</span>
    </div>
  </div>
</div>

<a th:href="@{/classInfo}" th:color="red" class="btn btn-primary btn-sm mb-3"> 返回班级管理页面 </a>
<a th:href="@{/}" th:color="red" class="btn btn-primary btn-sm mb-3"> 返回系统首页 </a>
</body>
</html>